# encoding: utf-8

import pyautogui
import time
import win32gui
import win32con
import sys

class UI:
    def __init__(self):
        pass

    @classmethod
    def start(self):
        time.sleep(10)
        return True
        '''
        time.sleep(10)
        hid = win32gui.WindowFromPoint((0, 0))
        # 获取窗口标题
        title = win32gui.GetWindowText(hid)
        self.__wincurhd = win32gui.FindWindow(None, title)
        win32gui.ShowWindow(self.__wincurhd, win32con.SW_MINIMIZE)
        '''

    @classmethod
    def getTitle(cls):
        hid = win32gui.WindowFromPoint((0, 0))
        # 获取窗口标题
        return win32gui.GetWindowText(hid)


    @classmethod
    def startHide(self):
        time.sleep(10)
        hid = win32gui.WindowFromPoint((0, 0))
        # 获取窗口标题
        title = win32gui.GetWindowText(hid)
        self.__wincurhd = win32gui.FindWindow(None, title)
        win32gui.ShowWindow(self.__wincurhd, win32con.SW_MINIMIZE)


    @classmethod
    def setWindowMax(self, title):
        self.__wincurhd = win32gui.FindWindow(None, title)
        win32gui.ShowWindow(self.__wincurhd, win32con.SW_MAXIMIZE)

    @classmethod
    def sleep(self,second):
        time.sleep(second)

    @classmethod
    def debug(self,msg):
        print(msg)

    @classmethod
    def end(self):
        return True
        '''
        time.sleep(5)
        win32gui.ShowWindow(self.__wincurhd, win32con.SW_MAXIMIZE)
        '''

    @classmethod
    def exit(cls):
        print("process exit!")
        sys.exit(0)

    @classmethod
    def getCurrentTitle(cls):
        hid = win32gui.WindowFromPoint((0, 0))
        # 获取窗口标题
        return win32gui.GetWindowText(hid)